from django.db import models

# Create your models here.


#店主表
class ShopUser(models.Model):
    username = models.CharField(max_length=200,verbose_name='店主姓名')
    password = models.CharField(max_length=200)
    class Meta:
        db_table = 'shopuser'
        verbose_name = '店主表'
        verbose_name_plural=verbose_name

    def __str__(self):
        return self.username

#商品表
class Shops(models.Model):
    name = models.CharField(max_length=200)
    price = models.DecimalField(max_digits=7,decimal_places=2)
    userid = models.ForeignKey('ShopUser',on_delete=models.CASCADE,null=True,blank=True)
    img = models.ImageField(default='')

    class Meta:
        db_table = 'shops'
        verbose_name = '商品表'


    def __str__(self):
        return self.name




